home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE23 / STARTUP / StubDll32U.pas < prev    next >
Pascal/Delphi Source File  |  1997-04-06  |  926b  |  50 lines

  1. unit StubDll32U;
  2.  
  3. {$ifdef Ver90} //Delphi 2.0x
  4.   {$define Delphi2}
  5. {$endif}
  6. {$ifdef Ver93} //C++ Builder 1.0x
  7.   {$define Delphi2}
  8. {$endif}
  9.  
  10. interface
  11.  
  12. implementation
  13.  
  14. uses
  15.   SysUtils;
  16.  
  17. var
  18.   OldExitProc: Pointer;
  19.  
  20. procedure NewExitProc;
  21. begin
  22.   ExitProc := OldExitProc;
  23.   WriteLn('DLL: Exit procedure added the old fashioned way (ExitProc)');
  24. end;
  25.  
  26. procedure NewerExitProc;
  27. begin
  28.   WriteLn('DLL: Exit procedure added with AddExitProc');
  29. end;
  30.  
  31. {$ifndef Delphi2}
  32. function NewTerminateProc: Boolean;
  33. begin
  34.   Result := True;
  35.   WriteLn('APP: Terminate function added with AddTerminateProc');
  36. end;
  37. {$endif}
  38.  
  39. initialization
  40.   WriteLn('DLL: Unit initialisation section');
  41.   OldExitProc := ExitProc;
  42.   ExitProc := @NewExitProc;
  43.   AddExitProc(@NewerExitProc);
  44. {$ifndef Delphi2}
  45.   AddTerminateProc(NewTerminateProc)
  46. {$endif}
  47. finalization
  48.   WriteLn('DLL: Unit finalisation section');
  49. end.
  50.